package cn.mars4j.nutch.web.parser;

import java.util.Map;


public class WanfangParser extends BaseParser {
	
	/**
	 * 万方地址_S
	 */
	public static final String S_WANFANG = "http://s.wanfangdata.com.cn/";

	/**
	 * 构造函数
	 * @param context
	 */
	public WanfangParser(Map<Object, Object> context) {
		super("wanfang.xml");
		this.context.putAll(context);
		
		// 分类
		String classify = (String)context.get(Parser.CLASSIFY);
		
		if ("QK".equals(classify)) {
			this.context.put(Parser.URL, S_WANFANG + "Paper.aspx?q="+ context.get(Parser.MKEY) + "+DBID%3aWF_QK");
		} else if ("HY".equals(classify)) {
			this.context.put(Parser.URL, S_WANFANG + "Paper.aspx?q="+ context.get(Parser.MKEY) + "+DBID%3aWF_HY");
		} else {
			this.context.put(Parser.URL, S_WANFANG + "Paper.aspx?q="+ context.get(Parser.MKEY));
		}
	}
	
	/**
	 * 设置配置文件参数
	 * @param context
	 */
	protected Map<Object, Object> getContext() {
		return this.context;
	}
}
